UPDATE 
  q_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OqMQWaymx5TbXGIJV9mrFBcV3SfVQ5rDGNUnFFsI8f4=' 
WHERE 
  key_id = 'd36b1c7afdae9a83a86031deb967d0bfacf95ab26c211a3a48840e84ec2cfeab' 
  AND (
    token = 'OqMQWaymx5TbXGIJV9mrFBcV3SfVQ5rDGNUnFFsI8f4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028