UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cX+7DwHIOVcYAz9ZzAQy2v0eUMZn+/cWcoCUv6L00gI='
WHERE
key_id = '4d2fb8cf7c31f252ad2aa830758ef413e26d96c74c15e40ab4cc058610a1866a'
AND (
token = 'cX+7DwHIOVcYAz9ZzAQy2v0eUMZn+/cWcoCUv6L00gI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)