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