UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H9c+2WQ7OoDvqzbAI4s0O5cK2Ft+mY8y3yJOVchpguY=' 
WHERE 
  key_id = '46d3124bd864f77406550f5bd8548f4831dc2d348bf006a2042759a144efbfa3' 
  AND (
    token = 'H9c+2WQ7OoDvqzbAI4s0O5cK2Ft+mY8y3yJOVchpguY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040