UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gRj7eWoW1ELEMcQBrF0RHdI8aZxCPJG49+6EEhL6wWo=' 
WHERE 
  key_id = '16b74e8c8e2986c9c078932308e208824932b07b81deb35eb886b723b8c6a711' 
  AND (
    token = 'gRj7eWoW1ELEMcQBrF0RHdI8aZxCPJG49+6EEhL6wWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029