UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SsCd2M8iFQA1OQ2qDNc7o4aNjEe0k1lBhmaoYKvZ+p4='
WHERE
key_id = '67571daf97114a99918f661488bc361ef0df6035d6f77ee7ac9ba9b703f0b465'
AND (
token = 'SsCd2M8iFQA1OQ2qDNc7o4aNjEe0k1lBhmaoYKvZ+p4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)