UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V9i1UlKSShI1uSE6OEJhNgHzHdgYgn+aPCKkLd36Vhk='
WHERE
key_id = 'd8478a45317d2653898d16b23108f125a7ce4dd36e8848fc8e76a729d216f331'
AND (
token = 'V9i1UlKSShI1uSE6OEJhNgHzHdgYgn+aPCKkLd36Vhk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)