UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o+gId9w7eL0O+qlt9koeWrZuv3atWUTkeDPxmQFb2L8=' 
WHERE 
  key_id = '18db6273038f09dd090e1c24612322fe8fbe62f3c168b6533adf1b5a14fb3711' 
  AND (
    token = 'o+gId9w7eL0O+qlt9koeWrZuv3atWUTkeDPxmQFb2L8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028