UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DKZprg4N0dqKPmGUbrn+g4MJIatNqEeFade495ujMsg='
WHERE
key_id = '51cef7c3999d4a43370656d56baf74fa733a92e804416008ee93f824b6f79e0e'
AND (
token = 'DKZprg4N0dqKPmGUbrn+g4MJIatNqEeFade495ujMsg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)