UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TbhHLMYuCwsIA4oyRixdm7hUFQv/1p44bPJUI50ttBw='
WHERE
key_id = 'c2adb1dd7de02a0e9eaefc685f4487bce1f02c38b3cbb25da708c187f48bfc5c'
AND (
token = 'TbhHLMYuCwsIA4oyRixdm7hUFQv/1p44bPJUI50ttBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)