UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gg2THXxYRz4PlW2NbrCVPIBldJttdGkgqyHoFgScSL4='
WHERE
key_id = 'ccba08ea03de5e34f569e0a6acf01e8f0a84c0667618658ed255349919264c9c'
AND (
token = 'Gg2THXxYRz4PlW2NbrCVPIBldJttdGkgqyHoFgScSL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)