UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nz0X7BMtiRb4pBZLCeqlo02hSlFktMMnfpoYQ1qoJ9g=' 
WHERE 
  key_id = '39ee6696941c983cd4647339d462cb4d0fe51ff457d51db450cd97b3c2c07b42' 
  AND (
    token = 'nz0X7BMtiRb4pBZLCeqlo02hSlFktMMnfpoYQ1qoJ9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039