UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6iOstWW5+QwPYVmYBeiz6T5nt7MdXb8pMJMrPz7NnQ=' 
WHERE 
  key_id = '55fa432a7fc14ebd521cdf52d810372bd59da2503ce6e061882ba74ef9e5b10f' 
  AND (
    token = 'G6iOstWW5+QwPYVmYBeiz6T5nt7MdXb8pMJMrPz7NnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032