UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ksJY+FNYlfox1/k54izrxJ0PeLNo9e1oiz7r5gBlme4='
WHERE
key_id = 'ca43bc466fc5644e3725d1d66ebc0e1ecf78b300f6f6d5e68a8e8c676f65f8f3'
AND (
token = 'ksJY+FNYlfox1/k54izrxJ0PeLNo9e1oiz7r5gBlme4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)