UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CtYt8N0L1RFCyHO4pAVTucNXAPTwbDLTLzIoah0/bV4='
WHERE
key_id = '9f8e5ecfd4483cb78f9286ee8d2c8b02598df041886fe57132552d36a85f5a1f'
AND (
token = 'CtYt8N0L1RFCyHO4pAVTucNXAPTwbDLTLzIoah0/bV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)