UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vpwpJ9LHXjAHu7n6m2NBYzxZ+NZO+ToVp1Zvq8Ugdi8='
WHERE
key_id = '6d9b06e3ff313698bf9917a1f172f6146d0585a2068ca2bcbfaa9b06ee103d8b'
AND (
token = 'vpwpJ9LHXjAHu7n6m2NBYzxZ+NZO+ToVp1Zvq8Ugdi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)