UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zw2Tb7mRWFjQ2kw1tnC83XBH7b3hx5fRa1GfdmtyxA8='
WHERE
key_id = '5f21923ce2fc40bdbbef2185a9ab1ae0fad7dc0384a7309115e393610b3ec149'
AND (
token = 'Zw2Tb7mRWFjQ2kw1tnC83XBH7b3hx5fRa1GfdmtyxA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)