UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3BXlfzHcv3FhOoYLE1jzCx2W7FMr2c8HL6XuU2jgIPs=' 
WHERE 
  key_id = '49602c7b59e7e600902f3984835620f7951cb90a3892d73d18a55a06de6c61d1' 
  AND (
    token = '3BXlfzHcv3FhOoYLE1jzCx2W7FMr2c8HL6XuU2jgIPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042