UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DTYAl5azM07fjfx7onE76vWRDX5yIX9IWMhX29hnFJc=' 
WHERE 
  key_id = 'a83c9d1c220611fd6812baa69311b743bc4becd8c59871ad01011ab2baee7cb7' 
  AND (
    token = 'DTYAl5azM07fjfx7onE76vWRDX5yIX9IWMhX29hnFJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033