UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Wg40dxAQ58ABavTqFOavk2m2HH6nwv44pk5v3ECREU='
WHERE
key_id = '8f08b17f7ee7897e5b4c4dbd426e278ec4d8dbc39feb8b1d1622fe971f03d8b6'
AND (
token = '6Wg40dxAQ58ABavTqFOavk2m2HH6nwv44pk5v3ECREU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)