UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SD793aTUWuPsSaFSTT7Ne5koEaH64VgxynlyRD93l5c=' 
WHERE 
  key_id = '7c47ade0660f33fba9f8bafc7f3930d36100a65f9d2a6db4c336f8492e945805' 
  AND (
    token = 'SD793aTUWuPsSaFSTT7Ne5koEaH64VgxynlyRD93l5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042