UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e29sQx33Ale9M7WGhmsJ+3yJol1N3IILYZe9gx8GhbI=' 
WHERE 
  key_id = '32611f1a47fc0a992934f1d78a15ed3bd1aef459638779373039f4e46ba65277' 
  AND (
    token = 'e29sQx33Ale9M7WGhmsJ+3yJol1N3IILYZe9gx8GhbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035