UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hakaQrWTlc5uCLmE9jKcBokrMM8Bnf4YpBJfCDxoZqc=' 
WHERE 
  key_id = 'c54ee9d3429733e735474ce3f395992d98cf845f205a468deb4ca481f0ab5b3a' 
  AND (
    token = 'hakaQrWTlc5uCLmE9jKcBokrMM8Bnf4YpBJfCDxoZqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028