UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K5CqwUhsJlM0EXxd7n6Nyni6H/RfpOVOwepu265024I=' 
WHERE 
  key_id = '7f3eaf4231378df24e79889662b732739edd253d18bb29d7295d39eae4ba3968' 
  AND (
    token = 'K5CqwUhsJlM0EXxd7n6Nyni6H/RfpOVOwepu265024I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040