UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wU155uzo1QfiatqgUIO44hBxasMfys9/My4xQIvYuSk='
WHERE
key_id = '507c1fbf2aa1926bad06964a55c73eb36a89d819736d13bd4e308fb9d287d50f'
AND (
token = 'wU155uzo1QfiatqgUIO44hBxasMfys9/My4xQIvYuSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)