UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ABShx0xPKUWJ0js9Kx0QPR6kIgmfMaH2c2BWs1O39VM=' 
WHERE 
  key_id = '1bc132eb3a66ea358cc83d32678be54c00ec695abdbaab1996af0b2e4db6fda3' 
  AND (
    token = 'ABShx0xPKUWJ0js9Kx0QPR6kIgmfMaH2c2BWs1O39VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038