UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NqaHJKOWfG3KTEV23HvSlHxU9wEdvCykeDQPZlYJgcc=' 
WHERE 
  key_id = '99e6375e2c93b6e37e6cf864fc9e9f0348c7d0c35656cd236e64e5e1cc39bec1' 
  AND (
    token = 'NqaHJKOWfG3KTEV23HvSlHxU9wEdvCykeDQPZlYJgcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048