UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f7ZuU4tIQxSiQiAS/8posMOb/na4Ciy3J873pE2pNY4='
WHERE
key_id = 'c232a15adec48bc7f850350c718510d13cee9ed7b8d1b0e3d2928ebd45be13f3'
AND (
token = 'f7ZuU4tIQxSiQiAS/8posMOb/na4Ciy3J873pE2pNY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)