UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r18ftJqd4VsJxaJ9eK9TEqDgFJFYfnq5fyINvkCYiC0='
WHERE
key_id = 'ca7b94d579c9a0ddde4912647c37e842ccf7a98fc82ae4cc17d93fb57a74a44c'
AND (
token = 'r18ftJqd4VsJxaJ9eK9TEqDgFJFYfnq5fyINvkCYiC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)