UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wAtHXosZptcSSf/MvbjyherFXmE/OCsYrBxHknp+7tI=' 
WHERE 
  key_id = '865cb61136f6593f3f695aeb851a5c03a6b97c885c4c98cbd6651fc7ee42b989' 
  AND (
    token = 'wAtHXosZptcSSf/MvbjyherFXmE/OCsYrBxHknp+7tI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025