UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'egWZXnLZroaLqNU9Fsw5KMURK2lLn89UMGJubmfbO8U='
WHERE
key_id = '47c44829f0f7540328aecab86c0a7177f4dddef07f37dec298c3e282fc159f87'
AND (
token = 'egWZXnLZroaLqNU9Fsw5KMURK2lLn89UMGJubmfbO8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)