UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6ma4MzVZkTII+x4xfg0aaI6XMi57uvk7CpMAlkJIUc=' 
WHERE 
  key_id = '5c68df6138931e2505b38df7d1d6c54b2cc15f6a77e83aeebfb6dab01da2f785' 
  AND (
    token = 'K6ma4MzVZkTII+x4xfg0aaI6XMi57uvk7CpMAlkJIUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025