UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A/qCw5XNRUecdFRAhSTKrT4ldr49edANQyzsVt6Odvc=' 
WHERE 
  key_id = 'f736e8907161f9de9187cfa0592f6f46cb92adb386b8f1d86d60fe6a1ddf74d9' 
  AND (
    token = 'A/qCw5XNRUecdFRAhSTKrT4ldr49edANQyzsVt6Odvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034