UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MZBU8AKIWox0UKekU7sVMMLJGw6ie3gbEG5ZQRRskms='
WHERE
key_id = '0f42dc17b93d867ef02085df01c9c4b61d14753b487baec1ad9cab1fa6a0ecf7'
AND (
token = 'MZBU8AKIWox0UKekU7sVMMLJGw6ie3gbEG5ZQRRskms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)