UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'THcLmhU4GfxaZpST1rYHANbxqtTDvwg6XkJKvDjAd7Y='
WHERE
key_id = '7a643ba609abafbb573fe36055a9971faa67c394587e90baa256781f085234a1'
AND (
token = 'THcLmhU4GfxaZpST1rYHANbxqtTDvwg6XkJKvDjAd7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)