UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KmqHm8/TPpDYT6d/DPIi5UqgQ6BTyYYtR+/FfxnNfOI='
WHERE
key_id = '7e951c6b9802f19f29b6015425017b612310e0a949434890897a716f0282c24f'
AND (
token = 'KmqHm8/TPpDYT6d/DPIi5UqgQ6BTyYYtR+/FfxnNfOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)