UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bUSd9y/CmAOenACp4YudDuWZtRNpm6oRX6CyHFAtemc=' 
WHERE 
  key_id = 'd78bda243ab359dcad015f0a7d2c1b21550fd2196735304f7ddb91524b6a6b2a' 
  AND (
    token = 'bUSd9y/CmAOenACp4YudDuWZtRNpm6oRX6CyHFAtemc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026