UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aCbutZebzsiJed9JCUQ9Qy93k/eSc4AZ1A1gxAGur70='
WHERE
key_id = '26e8f1947b7595e17042f83effc64358731f2a739c9d9433138c4483f4951d5a'
AND (
token = 'aCbutZebzsiJed9JCUQ9Qy93k/eSc4AZ1A1gxAGur70='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)