UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LaSUbXWjEBolpE0J4YYIr6FteGsNCX5kZDrHN76zICI=' 
WHERE 
  key_id = '0dafe9b11daf2ae9c961e77b60c38f50338e6289880e1c9dec635711cecb8262' 
  AND (
    token = 'LaSUbXWjEBolpE0J4YYIr6FteGsNCX5kZDrHN76zICI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043