UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9K/vlF4SuBf8fL5aUvjgzP8RLdwkAfED72caqfp9fE0='
WHERE
key_id = '2258b14633e3408047f856f6a8b8348ffbee3b44d7770e2286b4df7e38049971'
AND (
token = '9K/vlF4SuBf8fL5aUvjgzP8RLdwkAfED72caqfp9fE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)