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

Query time 0.00038