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