UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9VxWteAr1kJOlejhmV3l74uYfnhuLbgKMYKvonNQ19U=' 
WHERE 
  key_id = '40a64c332205ba387ed6f32c4f8a27c7b879148877258667013ad7e869dc93ee' 
  AND (
    token = '9VxWteAr1kJOlejhmV3l74uYfnhuLbgKMYKvonNQ19U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034