UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RV/4Rl/5DS8SKiRUbXyWsu/M5X3dUBupCg8Bi7iAhs8=' 
WHERE 
  key_id = '2608540846496d510e5cbcc5cb8b71285495e6460d0bdda4fcafef839349817c' 
  AND (
    token = 'RV/4Rl/5DS8SKiRUbXyWsu/M5X3dUBupCg8Bi7iAhs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030