UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MKeyD5pJWnyfpE7ttk4xJEsT/TNwydBLcCMi2KGAqws='
WHERE
key_id = '29f16fbab05daf0644d06a3d0fae72b0e92b2cb4808a2593ea385142394c4b15'
AND (
token = 'MKeyD5pJWnyfpE7ttk4xJEsT/TNwydBLcCMi2KGAqws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)