UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SNpaIc6eOsX68NaIMDKt/Bwq3nPDfqpwx6FPcJIS2kI=' 
WHERE 
  key_id = '9523ecdcda083447c6973e18732014889ccc22ee4911071c5a4ea13d08c3db50' 
  AND (
    token = 'SNpaIc6eOsX68NaIMDKt/Bwq3nPDfqpwx6FPcJIS2kI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024