UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLKi46h7AAIMCc0ong/cV51cOyroIaJvH/O6MM3oyPQ=' 
WHERE 
  key_id = '308b3cf4e6c3374ba87b045319c07ecee70be8be84901dfcddabcc8338b9db49' 
  AND (
    token = 'pLKi46h7AAIMCc0ong/cV51cOyroIaJvH/O6MM3oyPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025