UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AK/2pJwJX1mC3d+9L3qAeeYdOO4llnJAgifRaODOi34='
WHERE
key_id = '140f7f4ba6929dd071649cd0af3c1efa01cc90ec6e29c6448b6407f426231a58'
AND (
token = 'AK/2pJwJX1mC3d+9L3qAeeYdOO4llnJAgifRaODOi34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)