UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ioQmcHwe74O5gxnXBIGbeBzdDoYr40CRS/7Ke/Ttiuk='
WHERE
key_id = 'a2c326535685b42ec58b10ca8eaf94b31d8abc8c592b62f5232e509baa1400e9'
AND (
token = 'ioQmcHwe74O5gxnXBIGbeBzdDoYr40CRS/7Ke/Ttiuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)