UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZdEvQdawscyZWL8XcSqKASqpTMiA8xb41Nf9Bsp8ts4='
WHERE
key_id = '1c991f1b3f8f67ca6768d777790996b1eb0451067dee640dc3d5c4c4ee5152c7'
AND (
token = 'ZdEvQdawscyZWL8XcSqKASqpTMiA8xb41Nf9Bsp8ts4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)