UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fsfNdJH+L30nk84+0BCjvAJSsGKhPVLiTqKO+3amJwg='
WHERE
key_id = '698a285d23a92b2cce7667ff72697f3edce44b5c78d6de5fd2e011b17a05f8ea'
AND (
token = 'fsfNdJH+L30nk84+0BCjvAJSsGKhPVLiTqKO+3amJwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)