UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OuMqpgNgyvLdsAlpOUPcU8luxPfNyAJEDueTZP5sVzI=' 
WHERE 
  key_id = '3a580e276cea6280473d517369d2a2a1a2e2350a029adcaaf8feb84ae7c4971a' 
  AND (
    token = 'OuMqpgNgyvLdsAlpOUPcU8luxPfNyAJEDueTZP5sVzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041