UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iV1aFH58DruX9KiWNoQIyu3FZKm7SK61Buonx3mjYsA=' 
WHERE 
  key_id = '6c8ed49295d0fd301723f6827a4e605890756f93da539cec930e856558cf1c9e' 
  AND (
    token = 'iV1aFH58DruX9KiWNoQIyu3FZKm7SK61Buonx3mjYsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068